using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Leo.Entities;

namespace Leo.Repository.Mapping
{
    public class ClienteMap : EntityTypeConfiguration<Cliente>
    {
        public ClienteMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.RucDni)
                .IsRequired()
                .HasMaxLength(11);

            this.Property(t => t.NomRazonSocial)
                .IsRequired()
                .HasMaxLength(100);

            this.Property(t => t.Direccion)
                .IsRequired()
                .HasMaxLength(100);

            // Table & Column Mappings
            this.ToTable("Cliente");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.RucDni).HasColumnName("RucDni");
            this.Property(t => t.NomRazonSocial).HasColumnName("NomRazonSocial");
            this.Property(t => t.Direccion).HasColumnName("Direccion");
        }
    }
}
